<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="baidu-site-verification" content="L6Lm9d5Crl"/>
  
  
  
  
  <title>项目上线部署 | 昌晓的Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="上线部署1 、购买云服务器1阿里云，腾讯云，华为云  1.1 虚拟机安装Linux教程1http:&#x2F;&#x2F;www.liuqingzheng.top&#x2F;linux&#x2F;%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A&#x2F;02-Linux%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85&#x2F;  1.2 远程连接工具121.xshell  收费2.fin">
<meta property="og:type" content="article">
<meta property="og:title" content="项目上线部署">
<meta property="og:url" content="https://a_bowl_of_tea.gitee.io/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/index.html">
<meta property="og:site_name" content="昌晓的Blog">
<meta property="og:description" content="上线部署1 、购买云服务器1阿里云，腾讯云，华为云  1.1 虚拟机安装Linux教程1http:&#x2F;&#x2F;www.liuqingzheng.top&#x2F;linux&#x2F;%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A&#x2F;02-Linux%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85&#x2F;  1.2 远程连接工具121.xshell  收费2.fin">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-11-23T05:45:08.672Z">
<meta property="article:modified_time" content="2021-11-23T08:59:30.006Z">
<meta property="article:author" content="昌晓">
<meta name="twitter:card" content="summary">
  
    <link rel="alternative" href="/atom.xml" title="昌晓的Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/img/e.jpg">
  
  
  
<link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">

  
  
<link rel="stylesheet" href="/chen-changxiao/css/style.css">

  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  
  
      <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  
  <!-- 加载特效 -->
    <script src="/js/pace.js"></script>
    <link href="/css/pace/pace-theme-flash.css" rel="stylesheet" />
  <script>
      var yiliaConfig = {
          fancybox: true,
          animate: true,
          isHome: false,
          isPost: true,
          isArchive: false,
          isTag: false,
          isCategory: false,
          open_in_new: false
      }
  </script>
<meta name="generator" content="Hexo 5.4.0"></head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

        <a href="/" class="profilepic">
            
            <img lazy-src="/img/myavatar.jpg" class="js-avatar">
            
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/"></a></h1>
        </hgroup>
        
        
            <form>
                <input type="text" class="st-default-search-input search" id="local-search-input" placeholder="搜索一下" autocomplete="off">
            </form>
            <div id="local-search-result"></div>
        
        
            <script type="text/javascript">
                (function() {
                    'use strict';
                    function getMatchData(keyword, data) {
                        var matchData = [];
                        for(var i =0;i<data.length;i++){
                            if(data[i].title.toLowerCase().indexOf(keyword)>=0) 
                                matchData.push(data[i])
                        }
                        return matchData;
                    }
                    var $input = $('#local-search-input');
                    var $resultContent = $('#local-search-result');
                    $input.keyup(function(){
                        $.ajax({
                            url: '/search.json',
                            dataType: "json",
                            success: function( json ) {
                                var str='<ul class=\"search-result-list\">';                
                                var keyword = $input.val().trim().toLowerCase();
                                $resultContent.innerHTML = "";
                                if ($input.val().trim().length <= 0) {
                                    $resultContent.empty();
                                    $('#switch-area').show();
                                    return;
                                }
                                var results = getMatchData(keyword, json);
                                if(results.length === 0){
                                    $resultContent.empty();
                                    $('#switch-area').show();
                                    return;
                                } 
                                for(var i =0; i<results.length; i++){
                                    str += "<li><a href='"+ results[i].url +"' class='search-result-title'>"+ results[i].title +"</a></li>";
                                }
                                str += "</ul>";
                                $resultContent.empty();
                                $resultContent.append(str);
                                $('#switch-area').hide();
                            }
                        });
                    });
                })();
            </script>
        
        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        <div class="icon-wrap icon-link hide" data-idx="2">
                            <div class="loopback_l"></div>
                            <div class="loopback_r"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
                        <li>标签</li>
                        
                        <li>友情链接</li>
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        
        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a  href="/chen-changxiao/archives/">所有文章</a></li>
                        
                            <li><a  href="/chen-changxiao/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">玩转开发工具</a></li>
                        
                            <li><a  href="/chen-changxiao/categories/digital">玩转数码</a></li>
                        
                            <li><a  href="/chen-changxiao/categories/algorithm">算法学习</a></li>
                        
                            <li><a  href="/chen-changxiao/about/">关于我</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fl gitee"  target="_blank" href="https://gitee.com/a_bowl_of_tea" title="gitee">gitee</a>
                            
                                <a class="fl weibo"  target="_blank" href="/chen-changxiao/xxxxxxxx" title="weibo">weibo</a>
                            
                                <a class="fl rss"  target="_blank" href="/chen-changxiao/atom.xml" title="rss">rss</a>
                            
                        </ul>
                    </nav>
                </section>
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
                        
                    </div>
                </section>
                
                
                <section class="switch-part switch-part3">
                    <div id="js-friends">
                    
                      <a target="_blank"  class="main-nav-link switch-friends-link" href="https://blog.csdn.net/weixin_44884608?spm=1000.2115.3001.5343">csdn</a>
                    
                    </div>
                </section>
                
                
                
                <section class="switch-part switch-part4">
                
                    <div id="js-aboutme">爱动漫,爱游戏,爱编程,爱运动,爱的太多了!</div>
                </section>
                
            </div>
        </div>
    </header>
</div>

    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页"></a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                
                    <img lazy-src="/img/myavatar.jpg" class="js-avatar">
                
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页"></a></h1>
            </hgroup>
            
            <nav class="header-menu">
                <ul>
                
                    <li><a href="/chen-changxiao/archives/">所有文章</a></li>
                
                    <li><a href="/chen-changxiao/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">玩转开发工具</a></li>
                
                    <li><a href="/chen-changxiao/categories/digital">玩转数码</a></li>
                
                    <li><a href="/chen-changxiao/categories/algorithm">算法学习</a></li>
                
                    <li><a href="/chen-changxiao/about/">关于我</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                <div class="social">
                    
                        <a class="gitee" target="_blank" href="https://gitee.com/a_bowl_of_tea" title="gitee">gitee</a>
                    
                        <a class="weibo" target="_blank" href="/chen-changxiao/xxxxxxxx" title="weibo">weibo</a>
                    
                        <a class="rss" target="_blank" href="/chen-changxiao/atom.xml" title="rss">rss</a>
                    
                </div>
            </nav>
        </header>
    </div>
</nav>
      <div class="body-wrap"><article id="post-上线" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a  href="/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/" class="article-date">
      <time datetime="2021-11-23T05:45:08.672Z" itemprop="datePublished">2021-11-23</time>
</a>

    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      项目上线部署
    </h1>
  


      </header>
      
      <div class="article-info article-info-post">
        

        
        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <h1 id="上线部署"><a href="#上线部署" class="headerlink" title="上线部署"></a>上线部署</h1><h2 id="1-、购买云服务器"><a href="#1-、购买云服务器" class="headerlink" title="1 、购买云服务器"></a>1 、购买云服务器</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">阿里云，腾讯云，华为云</span><br></pre></td></tr></table></figure>

<h3 id="1-1-虚拟机安装Linux教程"><a href="#1-1-虚拟机安装Linux教程" class="headerlink" title="1.1 虚拟机安装Linux教程"></a>1.1 虚拟机安装Linux教程</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://www.liuqingzheng.top/linux/%E5%<span class="number">85</span>%A5%E9%<span class="number">97</span>%A8%E5%<span class="number">88</span>%B0%E7%B2%BE%E9%<span class="number">80</span>%9A/02-Linux%E7%B3%BB%E7%BB%9F%E5%AE%<span class="number">89</span>%E8%A3%<span class="number">85</span>/</span><br></pre></td></tr></table></figure>

<h3 id="1-2-远程连接工具"><a href="#1-2-远程连接工具" class="headerlink" title="1.2 远程连接工具"></a>1.2 远程连接工具</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>xshell  收费</span><br><span class="line"><span class="number">2.</span>finalshell 免费</span><br></pre></td></tr></table></figure>

<p>xshell远程连接服务器</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ssh root@<span class="number">8.130</span><span class="number">.176</span><span class="number">.65</span></span><br><span class="line">输入root用户密码</span><br></pre></td></tr></table></figure>

<h3 id="1-3阿里云服务配置"><a href="#1-3阿里云服务配置" class="headerlink" title="1.3阿里云服务配置"></a>1.3阿里云服务配置</h3><h4 id="更新yum源"><a href="#更新yum源" class="headerlink" title="更新yum源"></a>更新yum源</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># yum install 软件名</span></span><br><span class="line">yum update -y  <span class="comment"># 更新一下yum源</span></span><br></pre></td></tr></table></figure>

<h4 id="安装一下开发工具软件（git）-执行一个就可以"><a href="#安装一下开发工具软件（git）-执行一个就可以" class="headerlink" title="安装一下开发工具软件（git） 执行一个就可以"></a>安装一下开发工具软件（git） 执行一个就可以</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># yum install git</span></span><br><span class="line">yum -y groupinstall <span class="string">&quot;Development tools&quot;</span></span><br></pre></td></tr></table></figure>

<h4 id="安装额外依赖"><a href="#安装额外依赖" class="headerlink" title="安装额外依赖"></a>安装额外依赖</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># python 3.7的依赖</span></span><br><span class="line">yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel zlib* libffi-devel  -y</span><br></pre></td></tr></table></figure>

<h2 id="2-安装Mysql（rpm包安装）"><a href="#2-安装Mysql（rpm包安装）" class="headerlink" title="2 安装Mysql（rpm包安装）"></a>2 安装Mysql（rpm包安装）</h2><h3 id="2-1-前往用户根目录"><a href="#2-1-前往用户根目录" class="headerlink" title="2.1 前往用户根目录"></a>2.1 前往用户根目录</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">切换到家路径</span></span><br><span class="line">cd ~</span><br></pre></td></tr></table></figure>

<h3 id="2-2-下载MySQL57"><a href="#2-2-下载MySQL57" class="headerlink" title="2.2 下载MySQL57"></a>2.2 下载MySQL57</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 下载mysql 5.7的rpm包</span></span><br><span class="line">wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm</span><br></pre></td></tr></table></figure>

<h3 id="2-3-安装mysql57"><a href="#2-3-安装mysql57" class="headerlink" title="2.3 安装mysql57"></a>2.3 安装mysql57</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: yum -y install mysql57-community-release-el7-10.noarch.rpm</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: yum -y install mysql-community-server</span></span><br></pre></td></tr></table></figure>

<h3 id="2-4-启动mysql57并查看启动状态"><a href="#2-4-启动mysql57并查看启动状态" class="headerlink" title="2.4 启动mysql57并查看启动状态"></a>2.4 启动mysql57并查看启动状态</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: systemctl start mysqld.service  <span class="comment"># 启动mysql服务</span></span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: systemctl status mysqld.service</span></span><br></pre></td></tr></table></figure>

<h3 id="2-5-查看默认密码并登录"><a href="#2-5-查看默认密码并登录" class="headerlink" title="2.5 查看默认密码并登录"></a>2.5 查看默认密码并登录</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: grep <span class="string">&quot;password&quot;</span> /var/<span class="built_in">log</span>/mysqld.log <span class="comment"># 查看随机生成的密码是什么</span></span></span><br><span class="line"><span class="meta"> #</span><span class="bash"> MMa&lt;I45gphwj</span></span><br><span class="line"><span class="meta"> #</span><span class="bash"> &gt;zd&amp;kbuGl7fs</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: mysql -uroot -p</span></span><br></pre></td></tr></table></figure>

<h3 id="2-6-修改密码"><a href="#2-6-修改密码" class="headerlink" title="2.6 修改密码"></a>2.6 修改密码</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: ALTER USER <span class="string">&#x27;root&#x27;</span>@<span class="string">&#x27;localhost&#x27;</span> IDENTIFIED BY <span class="string">&#x27;Xiao1234?&#x27;</span>;</span></span><br></pre></td></tr></table></figure>

<h2 id="3-安装Redis-源码编译安装"><a href="#3-安装Redis-源码编译安装" class="headerlink" title="3 安装Redis(源码编译安装)"></a>3 安装Redis(源码编译安装)</h2><h3 id="3-1-前往用户根目录"><a href="#3-1-前往用户根目录" class="headerlink" title="3.1 前往用户根目录"></a>3.1 前往用户根目录</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd ~</span><br></pre></td></tr></table></figure>

<h3 id="3-2-下载redis-5-0-5"><a href="#3-2-下载redis-5-0-5" class="headerlink" title="3.2 下载redis-5.0.5"></a>3.2 下载redis-5.0.5</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: wget http://download.redis.io/releases/redis-5.0.5.tar.gz</span></span><br><span class="line">	    http://download.redis.io/releases/redis-6.0.6.tar.gz</span><br></pre></td></tr></table></figure>

<h3 id="3-3-解压安装包"><a href="#3-3-解压安装包" class="headerlink" title="3.3 解压安装包"></a>3.3 解压安装包</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: tar -xf redis-5.0.5.tar.gz</span></span><br></pre></td></tr></table></figure>

<h3 id="3-4-进入目标文件"><a href="#3-4-进入目标文件" class="headerlink" title="3.4 进入目标文件"></a>3.4 进入目标文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> redis-5.0.5</span></span><br></pre></td></tr></table></figure>

<h3 id="3-5-编译环境"><a href="#3-5-编译环境" class="headerlink" title="3.5 编译环境"></a>3.5 编译环境</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: make  <span class="comment"># 把源码编译成可执行文件</span></span></span><br></pre></td></tr></table></figure>

<h3 id="3-6-复制环境到指定路径完成安装"><a href="#3-6-复制环境到指定路径完成安装" class="headerlink" title="3.6 复制环境到指定路径完成安装"></a>3.6 复制环境到指定路径完成安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: cp -r ~/redis-5.0.5 /usr/<span class="built_in">local</span>/redis</span></span><br></pre></td></tr></table></figure>

<h3 id="3-7-配置redis可以后台启动：修改下方内容（可以不改）"><a href="#3-7-配置redis可以后台启动：修改下方内容（可以不改）" class="headerlink" title="3.7 配置redis可以后台启动：修改下方内容（可以不改）"></a>3.7 配置redis可以后台启动：修改下方内容（可以不改）</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: vim /usr/<span class="built_in">local</span>/redis/redis.conf</span></span><br><span class="line">daemonize yes</span><br></pre></td></tr></table></figure>

<h3 id="3-8-完成配置修改"><a href="#3-8-完成配置修改" class="headerlink" title="3.8 完成配置修改"></a>3.8 完成配置修改</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: esc</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: :wq</span></span><br></pre></td></tr></table></figure>

<h3 id="3-9-建立软连接-usr-bin-在环境变量下，以后任意路径敲这俩命令都可以"><a href="#3-9-建立软连接-usr-bin-在环境变量下，以后任意路径敲这俩命令都可以" class="headerlink" title="3.9 建立软连接 #/usr/bin/在环境变量下，以后任意路径敲这俩命令都可以"></a>3.9 建立软连接 #/usr/bin/在环境变量下，以后任意路径敲这俩命令都可以</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: ln -s /usr/<span class="built_in">local</span>/redis/src/redis-server /usr/bin/redis-server</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: ln -s /usr/<span class="built_in">local</span>/redis/src/redis-cli /usr/bin/redis-cli</span></span><br></pre></td></tr></table></figure>

<h3 id="3-10-后台运行redis"><a href="#3-10-后台运行redis" class="headerlink" title="3.10 后台运行redis"></a>3.10 后台运行redis</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> /usr/<span class="built_in">local</span>/redis</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: redis-server ./redis.conf &amp;  <span class="comment"># 使用配置文件启动</span></span></span><br><span class="line"></span><br><span class="line">停止： ctrl + c</span><br></pre></td></tr></table></figure>

<h3 id="3-11-测试redis环境"><a href="#3-11-测试redis环境" class="headerlink" title="3.11 测试redis环境"></a>3.11 测试redis环境</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: redis-cli</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 停止 ctrl + c</span></span><br></pre></td></tr></table></figure>

<h3 id="3-12-关闭redis服务"><a href="#3-12-关闭redis服务" class="headerlink" title="3.12 关闭redis服务"></a>3.12 关闭redis服务</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pkill -f redis -9</span><br></pre></td></tr></table></figure>

<h2 id="4-安装python解释器（3-8源码安装）"><a href="#4-安装python解释器（3-8源码安装）" class="headerlink" title="4 安装python解释器（3.8源码安装）"></a>4 安装python解释器（3.8源码安装）</h2><h3 id="4-1-前往用户根目录"><a href="#4-1-前往用户根目录" class="headerlink" title="4.1 前往用户根目录"></a>4.1 前往用户根目录</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> ~</span></span><br></pre></td></tr></table></figure>

<h3 id="4-2-解释器下载"><a href="#4-2-解释器下载" class="headerlink" title="4.2 解释器下载"></a>4.2 解释器下载</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: wget https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tar.xz</span></span><br></pre></td></tr></table></figure>

<h3 id="4-3-解压安装包"><a href="#4-3-解压安装包" class="headerlink" title="4.3 解压安装包"></a>4.3 解压安装包</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: tar -xf Python-3.8.8.tar.xz</span></span><br></pre></td></tr></table></figure>

<h3 id="4-4-进入目标文件"><a href="#4-4-进入目标文件" class="headerlink" title="4.4 进入目标文件"></a>4.4 进入目标文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> Python-3.8.8</span></span><br></pre></td></tr></table></figure>

<h3 id="4-5-配置安装路径：-usr-local-python3"><a href="#4-5-配置安装路径：-usr-local-python3" class="headerlink" title="4.5 配置安装路径：/usr/local/python3"></a>4.5 配置安装路径：/usr/local/python3</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 把python3.8.8 编译安装到/usr/<span class="built_in">local</span>/python38路径下</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: ./configure --prefix=/usr/<span class="built_in">local</span>/python38</span></span><br></pre></td></tr></table></figure>

<h3 id="4-6-编译并安装"><a href="#4-6-编译并安装" class="headerlink" title="4.6 编译并安装"></a>4.6 编译并安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: make &amp;&amp;  make install</span></span><br></pre></td></tr></table></figure>

<h3 id="4-7建立软连接：终端命令-python3，pip3"><a href="#4-7建立软连接：终端命令-python3，pip3" class="headerlink" title="4.7建立软连接：终端命令 python3，pip3"></a>4.7建立软连接：终端命令 python3，pip3</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: ln -s /usr/<span class="built_in">local</span>/python38/bin/python3 /usr/bin/python3.8</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: ln -s /usr/<span class="built_in">local</span>/python38/bin/pip3 /usr/bin/pip3.8</span></span><br></pre></td></tr></table></figure>

<h3 id="4-8-删除安装包与文件"><a href="#4-8-删除安装包与文件" class="headerlink" title="4.8 删除安装包与文件"></a>4.8 删除安装包与文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: rm -rf Python-3.8.8</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: rm -rf Python-3.8.8.tar.xz</span></span><br></pre></td></tr></table></figure>

<h2 id="5-安装uwsgi"><a href="#5-安装uwsgi" class="headerlink" title="5 安装uwsgi"></a>5 安装uwsgi</h2><h3 id="5-1-uwsgi-django运行"><a href="#5-1-uwsgi-django运行" class="headerlink" title="5.1 uwsgi+django运行"></a>5.1 uwsgi+django运行</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip3.8 install uwsgi     # 用c写的web服务器，性能高，能抗高并发</span><br></pre></td></tr></table></figure>

<h3 id="5-2-会有一个uwsgi的可执行文件"><a href="#5-2-会有一个uwsgi的可执行文件" class="headerlink" title="5.2 会有一个uwsgi的可执行文件"></a>5.2 会有一个uwsgi的可执行文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ln -s /usr/local/python38/bin/uwsgi /usr/bin/uwsgi</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 以后跑项目不是使用python manage.py runserver 跑了,并发量太低（wsgiref）</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 而是使用  uwsgi -配置文件   跑</span></span><br></pre></td></tr></table></figure>

<h2 id="6-安装虚拟环境"><a href="#6-安装虚拟环境" class="headerlink" title="6 安装虚拟环境"></a>6 安装虚拟环境</h2><h3 id="6-1-安装依赖"><a href="#6-1-安装依赖" class="headerlink" title="6.1 安装依赖"></a>6.1 安装依赖</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt;: pip3<span class="number">.8</span> install virtualenv</span><br><span class="line">&gt;: pip3<span class="number">.8</span> install virtualenvwrapper</span><br><span class="line">    </span><br><span class="line"><span class="comment"># 升级 pip python3.8 -m pip install --upgrade pip</span></span><br></pre></td></tr></table></figure>

<h3 id="6-2-建立虚拟环境软连接"><a href="#6-2-建立虚拟环境软连接" class="headerlink" title="6.2 建立虚拟环境软连接"></a>6.2 建立虚拟环境软连接</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ln -s /usr/local/python38/bin/virtualenv /usr/bin/virtualenv</span><br></pre></td></tr></table></figure>

<h3 id="6-3-配置虚拟环境：填入下方内容"><a href="#6-3-配置虚拟环境：填入下方内容" class="headerlink" title="6.3 配置虚拟环境：填入下方内容"></a>6.3 配置虚拟环境：填入下方内容</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 使用vim打开</span></span><br><span class="line">&gt;: vim ~/.bash_profile</span><br><span class="line">    </span><br><span class="line"><span class="comment"># 配置</span></span><br><span class="line">VIRTUALENVWRAPPER_PYTHON=/usr/<span class="built_in">bin</span>/python3<span class="number">.8</span></span><br><span class="line">source /usr/local/python38/<span class="built_in">bin</span>/virtualenvwrapper.sh</span><br></pre></td></tr></table></figure>

<h3 id="6-4-退出编辑状态"><a href="#6-4-退出编辑状态" class="headerlink" title="6.4 退出编辑状态"></a>6.4 退出编辑状态</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: esc</span></span><br></pre></td></tr></table></figure>

<h3 id="6-5-保存修改并退出"><a href="#6-5-保存修改并退出" class="headerlink" title="6.5 保存修改并退出"></a>6.5 保存修改并退出</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&gt;: :wq</span><br></pre></td></tr></table></figure>

<h3 id="6-6更新配置文件内容"><a href="#6-6更新配置文件内容" class="headerlink" title="6.6更新配置文件内容"></a>6.6更新配置文件内容</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">source</span> ~/.bash_profile</span></span><br></pre></td></tr></table></figure>

<h3 id="6-7-虚拟环境默认根目录："><a href="#6-7-虚拟环境默认根目录：" class="headerlink" title="6.7 虚拟环境默认根目录："></a>6.7 虚拟环境默认根目录：</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">~/.virtualenvs</span><br></pre></td></tr></table></figure>

<h3 id="6-8-创建虚拟环境"><a href="#6-8-创建虚拟环境" class="headerlink" title="6.8 创建虚拟环境"></a>6.8 创建虚拟环境</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkvirtualenv -p python3<span class="number">.8</span> 项目环境名</span><br></pre></td></tr></table></figure>

<h2 id="7-安装Nginx-请求转发，动静分类"><a href="#7-安装Nginx-请求转发，动静分类" class="headerlink" title="7 安装Nginx (请求转发，动静分类)"></a>7 安装Nginx (请求转发，动静分类)</h2><h3 id="7-1-前往用户根目录"><a href="#7-1-前往用户根目录" class="headerlink" title="7.1 前往用户根目录"></a>7.1 前往用户根目录</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> ~</span></span><br></pre></td></tr></table></figure>

<h3 id="7-2-下载nginx-1-13-7"><a href="#7-2-下载nginx-1-13-7" class="headerlink" title="7.2 下载nginx 1.13.7"></a>7.2 下载nginx 1.13.7</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: wget http://nginx.org/download/nginx-1.13.7.tar.gz</span></span><br></pre></td></tr></table></figure>

<h3 id="7-3-解压安装包"><a href="#7-3-解压安装包" class="headerlink" title="7.3 解压安装包"></a>7.3 解压安装包</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: tar -xf nginx-1.13.7.tar.gz</span></span><br></pre></td></tr></table></figure>

<h3 id="7-4-进入目标文件"><a href="#7-4-进入目标文件" class="headerlink" title="7.4 进入目标文件"></a>7.4 进入目标文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: <span class="built_in">cd</span> nginx-1.13.7</span></span><br></pre></td></tr></table></figure>

<h3 id="7-5-配置安装路径：-usr-local-nginx"><a href="#7-5-配置安装路径：-usr-local-nginx" class="headerlink" title="7.5 配置安装路径：/usr/local/nginx"></a>7.5 配置安装路径：/usr/local/nginx</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: ./configure --prefix=/usr/<span class="built_in">local</span>/nginx</span></span><br></pre></td></tr></table></figure>

<h3 id="7-6-编译并安装"><a href="#7-6-编译并安装" class="headerlink" title="7.6 编译并安装"></a>7.6 编译并安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: make &amp;&amp; sudo make install</span></span><br></pre></td></tr></table></figure>

<h3 id="7-7-建立软连接：终端命令-nginx"><a href="#7-7-建立软连接：终端命令-nginx" class="headerlink" title="7.7 建立软连接：终端命令 nginx"></a>7.7 建立软连接：终端命令 nginx</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: ln -s /usr/<span class="built_in">local</span>/nginx/sbin/nginx /usr/bin/nginx</span></span><br></pre></td></tr></table></figure>

<h3 id="7-8-删除安装包与文件："><a href="#7-8-删除安装包与文件：" class="headerlink" title="7.8 删除安装包与文件："></a>7.8 删除安装包与文件：</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&gt;: cd ~</span><br><span class="line">&gt;: rm -rf nginx-<span class="number">1.13</span><span class="number">.7</span></span><br><span class="line">&gt;: rm -rf nginx-<span class="number">1.13</span><span class="number">.7</span>.tar.xz</span><br></pre></td></tr></table></figure>

<h3 id="7-9测试Nginx环境，服务器运行nginx，本地访问服务器ip"><a href="#7-9测试Nginx环境，服务器运行nginx，本地访问服务器ip" class="headerlink" title="7.9测试Nginx环境，服务器运行nginx，本地访问服务器ip"></a>7.9测试Nginx环境，服务器运行nginx，本地访问服务器ip</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&gt;</span><span class="bash">: nginx</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: 服务器绑定的域名 或 ip:80</span></span><br></pre></td></tr></table></figure>

<h3 id="7-10-nginx-常用命令"><a href="#7-10-nginx-常用命令" class="headerlink" title="7.10  nginx 常用命令"></a>7.10  nginx 常用命令</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">1）启动</span><br><span class="line">    &gt;: nginx</span><br><span class="line">    &gt;: ps aux |grep nginx</span><br><span class="line"></span><br><span class="line">2）关闭nginx</span><br><span class="line">    &gt;: nginx -s stop</span><br><span class="line"></span><br><span class="line">3）重启nginx</span><br><span class="line">    &gt;: nginx -s reload</span><br><span class="line"></span><br><span class="line">4）查看端口，强行关闭</span><br><span class="line">    &gt;: ps -aux|grep nginx</span><br><span class="line">    &gt;: kill &lt;pid:进程编号&gt;</span><br></pre></td></tr></table></figure>

<h2 id="8-配置前端项目，上线部署"><a href="#8-配置前端项目，上线部署" class="headerlink" title="8 配置前端项目，上线部署"></a>8 配置前端项目，上线部署</h2><h3 id="8-1-把setting-js中的后端路径改成公网地址"><a href="#8-1-把setting-js中的后端路径改成公网地址" class="headerlink" title="8.1 把setting.js中的后端路径改成公网地址"></a>8.1 把setting.js中的后端路径改成公网地址</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">export  default &#123;</span><br><span class="line">    base_url:&#x27;http://8.130.176.65:8000/api/v1/&#x27;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="8-2-把vue项目编译成纯静态"><a href="#8-2-把vue项目编译成纯静态" class="headerlink" title="8.2 把vue项目编译成纯静态"></a>8.2 把vue项目编译成纯静态</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run build</span><br></pre></td></tr></table></figure>

<h3 id="8-3-在服务器上安装"><a href="#8-3-在服务器上安装" class="headerlink" title="8.3 在服务器上安装"></a>8.3 在服务器上安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">yum install  -y lrzsz  </span><br><span class="line">按住文件，拖到服务器即可</span><br><span class="line"><span class="meta">#</span><span class="bash"> 使用其他ftp软件上传</span></span><br></pre></td></tr></table></figure>

<h3 id="8-4-解压"><a href="#8-4-解压" class="headerlink" title="8.4 解压"></a>8.4 解压</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">yum install unzip -y</span><br><span class="line">unzip dist.zip </span><br><span class="line"></span><br><span class="line">mkdir /home/html</span><br><span class="line">mv ~/dist /home/html</span><br></pre></td></tr></table></figure>

<h3 id="8-5-配置nginx，代理静态文件"><a href="#8-5-配置nginx，代理静态文件" class="headerlink" title="8.5 配置nginx，代理静态文件"></a>8.5 配置nginx，代理静态文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">cd /usr/local/nginx/conf</span><br><span class="line"><span class="meta">#</span><span class="bash"> nginx.conf nginx 的配置文件</span></span><br><span class="line">mv nginx.conf nginx.conf.bak</span><br><span class="line">vi nginx.conf   # 写入下面</span><br><span class="line"></span><br><span class="line">events &#123;</span><br><span class="line">    worker_connections  1024;</span><br><span class="line">&#125;</span><br><span class="line">http &#123;</span><br><span class="line">    include       mime.types;</span><br><span class="line">    default_type  application/octet-stream;</span><br><span class="line">    sendfile        on;</span><br><span class="line">    server &#123;</span><br><span class="line">        listen 80;</span><br><span class="line">        server_name  127.0.0.1;</span><br><span class="line">        charset utf-8;</span><br><span class="line">        location / &#123;</span><br><span class="line">            root /home/html/dist; # html访问路径</span><br><span class="line">            index index.html; # html文件名称</span><br><span class="line">            try_files $uri $uri/ /index.html; # 解决单页面应用刷新404问题</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125; </span><br></pre></td></tr></table></figure>

<h3 id="8-6-重启nginx即可"><a href="#8-6-重启nginx即可" class="headerlink" title="8.6 重启nginx即可"></a>8.6 重启nginx即可</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">nginx -s stop</span><br><span class="line">niginx</span><br></pre></td></tr></table></figure>

<h3 id="8-7-访问IP就能看到前端"><a href="#8-7-访问IP就能看到前端" class="headerlink" title="8.7 访问IP就能看到前端"></a>8.7 访问IP就能看到前端</h3><h2 id="9-配置后台项目，部署"><a href="#9-配置后台项目，部署" class="headerlink" title="9 配置后台项目，部署"></a>9 配置后台项目，部署</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 项目在服务器上运行，关于migrations要不要提交的问题</span></span><br><span class="line">	-如果提交：好处是可以看到开发阶段所有的表变化情况</span><br><span class="line">    -如果不提交：服务端自己维护一套迁移变化，不会出冲突</span><br></pre></td></tr></table></figure>

<h3 id="9-1-项目依赖库"><a href="#9-1-项目依赖库" class="headerlink" title="9.1 项目依赖库"></a>9.1 项目依赖库</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">-放在项目根路径下：requirements.txt</span><br><span class="line">   -pip list   # 当前环境安装了哪些模块</span><br><span class="line">   -pip freeze &gt; requirements.txt # 把当前虚拟环境中所的依赖，写入到requirements.txt</span><br></pre></td></tr></table></figure>

<h3 id="9-2-在服务器上，把后端项目拉下来"><a href="#9-2-在服务器上，把后端项目拉下来" class="headerlink" title="9.2 在服务器上，把后端项目拉下来"></a>9.2 在服务器上，把后端项目拉下来</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir /home/project</span><br><span class="line">cd /home/project</span><br><span class="line">git clone https://gitee.com/liuqingzheng/luffy_api.git</span><br></pre></td></tr></table></figure>

<h3 id="9-3-创建虚拟环境，在虚拟环境中，把所有依赖装好"><a href="#9-3-创建虚拟环境，在虚拟环境中，把所有依赖装好" class="headerlink" title="9.3 创建虚拟环境，在虚拟环境中，把所有依赖装好"></a>9.3 创建虚拟环境，在虚拟环境中，把所有依赖装好</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">workon luffy</span><br><span class="line">pip install -r requirements.txt</span><br><span class="line"><span class="meta">#</span><span class="bash"> mysqlclient装不上</span></span><br><span class="line">yum install mysql-devel</span><br><span class="line">yum install python-devel</span><br><span class="line">pip install mysqlclient</span><br><span class="line">pip install -r requirements.txt</span><br><span class="line">pip install uwsgi   # 在正式环境和虚拟环境都要装一下uwsgi</span><br></pre></td></tr></table></figure>

<h3 id="9-4-配置数据库"><a href="#9-4-配置数据库" class="headerlink" title="9.4 配置数据库"></a>9.4 配置数据库</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">1）管理员连接数据库</span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: mysql -uroot -pLqz1234?</span></span><br><span class="line"></span><br><span class="line">2）创建数据库</span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: create database luffy default charset=utf8;</span></span><br><span class="line"></span><br><span class="line">3）设置权限账号密码：账号密码要与项目中配置的一致</span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: grant all privileges on luffy.* to <span class="string">&#x27;luffynew&#x27;</span>@<span class="string">&#x27;%&#x27;</span> identified by <span class="string">&#x27;Luffy123?&#x27;</span>;</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: grant all privileges on luffy.* to <span class="string">&#x27;luffynew&#x27;</span>@<span class="string">&#x27;localhost&#x27;</span> identified by <span class="string">&#x27;Luffy123?&#x27;</span>;</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: flush privileges;</span></span><br><span class="line"></span><br><span class="line">4）退出mysql</span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: quit;</span></span><br></pre></td></tr></table></figure>

<h3 id="9-5-迁移命令"><a href="#9-5-迁移命令" class="headerlink" title="9.5 迁移命令"></a>9.5 迁移命令</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">python manage_pro.py makemigrations</span><br><span class="line">python manage_pro.py migrate</span><br></pre></td></tr></table></figure>

<h3 id="9-6-使用uwsgi-django运行项目"><a href="#9-6-使用uwsgi-django运行项目" class="headerlink" title="9.6 使用uwsgi+django运行项目"></a>9.6 使用uwsgi+django运行项目</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 先用python manage_pro.py runserver 0.0.0.0:8000 跑一下试试</span></span><br></pre></td></tr></table></figure>

<h3 id="9-7写uwsgi的配置文件，项目根路径"><a href="#9-7写uwsgi的配置文件，项目根路径" class="headerlink" title="9.7写uwsgi的配置文件，项目根路径"></a>9.7写uwsgi的配置文件，项目根路径</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> vim luffy.xml</span></span><br><span class="line">&lt;uwsgi&gt;</span><br><span class="line">   &lt;socket&gt;127.0.0.1:8080&lt;/socket&gt;</span><br><span class="line">   &lt;chdir&gt;/home/project/luffy_api&lt;/chdir&gt;         </span><br><span class="line">   &lt;module&gt;luffy_api.wsgi&lt;/module&gt;</span><br><span class="line">   &lt;processes&gt;4&lt;/processes&gt;</span><br><span class="line">   &lt;daemonize&gt;uwsgi.log&lt;/daemonize&gt;</span><br><span class="line">&lt;/uwsgi&gt;</span><br></pre></td></tr></table></figure>

<h3 id="9-8启动uwsgi"><a href="#9-8启动uwsgi" class="headerlink" title="9.8启动uwsgi"></a>9.8启动uwsgi</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">uwsgi -x ./luffy.xml</span><br><span class="line">ps aux |grep uwsgi</span><br></pre></td></tr></table></figure>

<h3 id="9-9-关闭uwsgi"><a href="#9-9-关闭uwsgi" class="headerlink" title="9.9 关闭uwsgi"></a>9.9 关闭uwsgi</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pkill -9 uwsgi</span><br></pre></td></tr></table></figure>

<h3 id="9-10配置nginx转发给uwsgi"><a href="#9-10配置nginx转发给uwsgi" class="headerlink" title="9.10配置nginx转发给uwsgi"></a>9.10配置nginx转发给uwsgi</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line">       listen 8000;</span><br><span class="line">       server_name  127.0.0.1;</span><br><span class="line">       charset utf-8;</span><br><span class="line">       location / &#123;</span><br><span class="line">          include uwsgi_params;</span><br><span class="line">          uwsgi_pass 127.0.0.1:8080;  # 端口要和uwsgi里配置的一样</span><br><span class="line">          uwsgi_param UWSGI_SCRIPT luffy_api.wsgi;  #wsgi.py所在的目录名+.wsgi</span><br><span class="line">          uwsgi_param UWSGI_CHDIR /home/project/luffy_api/; # 项目路径</span><br><span class="line">       &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<h3 id="9-11-查看端口被哪个进程监听"><a href="#9-11-查看端口被哪个进程监听" class="headerlink" title="9.11 查看端口被哪个进程监听"></a>9.11 查看端口被哪个进程监听</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -nlp|grep 80</span><br></pre></td></tr></table></figure>

<h3 id="9-12-导入测试数据"><a href="#9-12-导入测试数据" class="headerlink" title="9.12 导入测试数据"></a>9.12 导入测试数据</h3><h3 id="9-13-后台管理，动静分离"><a href="#9-13-后台管理，动静分离" class="headerlink" title="9.13 后台管理，动静分离"></a>9.13 后台管理，动静分离</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">修改线上的pro.py 配置文件，加入</span></span><br><span class="line">STATIC_ROOT = &#x27;/home/project/luffy_api/luffy_api/static&#x27;  </span><br><span class="line">STATICFILES_DIRS = (os.path.join(BASE_DIR, &quot;static&quot;),)</span><br><span class="line"><span class="meta">#</span><span class="bash"> 创建文件夹</span></span><br><span class="line"><span class="meta">&gt;</span><span class="bash">: mkdir /home/project/luffy_api/luffy_api/static</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 完成静态文件迁移（把静态的js，css都收集到，上面那个文件夹下）</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 前后端混合的项目必须这么做</span></span><br><span class="line">python manage_pro.py collectstatic</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="9-14-使用nginx代理"><a href="#9-14-使用nginx代理" class="headerlink" title="9.14 使用nginx代理"></a>9.14 使用nginx代理</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta"> #</span><span class="bash"> 新增的配置静态文件</span></span><br><span class="line">location /static &#123;</span><br><span class="line">    alias /home/project/luffy_api/luffy_api/static;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="9-15-重启nginx即可"><a href="#9-15-重启nginx即可" class="headerlink" title="9.15 重启nginx即可"></a>9.15 重启nginx即可</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nginx -s reload</span><br></pre></td></tr></table></figure>

<h3 id="9-16-项目根路径下启异步任务"><a href="#9-16-项目根路径下启异步任务" class="headerlink" title="9.16 项目根路径下启异步任务"></a>9.16 项目根路径下启异步任务</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">celery -A xx  worker -l info</span><br><span class="line">celery -A xx  beat -l info</span><br></pre></td></tr></table></figure>

<h3 id="9-17-项目连接上域名"><a href="#9-17-项目连接上域名" class="headerlink" title="9.17 项目连接上域名"></a>9.17 项目连接上域名</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">1 买一个域名：</span><br><span class="line">2 在阿里云的域名解析配置一下</span><br></pre></td></tr></table></figure>




      
    </div>
    
  </div>
  
    
    <div class="copyright">
        <p><span>本文标题:</span><a  href="/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/">项目上线部署</a></p>
        <p><span>文章作者:</span><a  href="/" title="访问  的个人博客"></a></p>
        <p><span>发布时间:</span>2021年11月23日 - 13时45分</p>
        <p><span>最后更新:</span>2021年11月23日 - 16时59分</p>
        <p>
            <span>原始链接:</span><a class="post-url" href="/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/" title="项目上线部署">https://a_bowl_of_tea.gitee.io/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/</a>
            <span class="copy-path" data-clipboard-text="原文: https://a_bowl_of_tea.gitee.io/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/　　作者: " title=""></span>
        </p>
        <p>
            <span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" title="中国大陆 (CC BY-NC-SA 3.0 CN)" target = "_blank">"署名-非商用-相同方式共享 3.0"</a> 转载请保留原文链接及作者。
        </p>
    </div>



<nav id="article-nav">
  
    <a  href="/chen-changxiao/2021/11/23/Docker%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption"><</strong>
      <div class="article-nav-title">
        
          Docker一键部署
        
      </div>
    </a>
  
  
    <a  href="/chen-changxiao/2021/11/23/MySQL%E5%AE%89%E8%A3%85/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">MySQL数据库</div>
      <strong class="article-nav-caption">></strong>
    </a>
  
</nav>


  
</article>

    <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录</strong>
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%8A%E7%BA%BF%E9%83%A8%E7%BD%B2"><span class="toc-number">1.</span> <span class="toc-text">上线部署</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E3%80%81%E8%B4%AD%E4%B9%B0%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">1.1.</span> <span class="toc-text">1 、购买云服务器</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-1-%E8%99%9A%E6%8B%9F%E6%9C%BA%E5%AE%89%E8%A3%85Linux%E6%95%99%E7%A8%8B"><span class="toc-number">1.1.1.</span> <span class="toc-text">1.1 虚拟机安装Linux教程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2-%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5%E5%B7%A5%E5%85%B7"><span class="toc-number">1.1.2.</span> <span class="toc-text">1.2 远程连接工具</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-3%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E9%85%8D%E7%BD%AE"><span class="toc-number">1.1.3.</span> <span class="toc-text">1.3阿里云服务配置</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%9B%B4%E6%96%B0yum%E6%BA%90"><span class="toc-number">1.1.3.1.</span> <span class="toc-text">更新yum源</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E4%B8%80%E4%B8%8B%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7%E8%BD%AF%E4%BB%B6%EF%BC%88git%EF%BC%89-%E6%89%A7%E8%A1%8C%E4%B8%80%E4%B8%AA%E5%B0%B1%E5%8F%AF%E4%BB%A5"><span class="toc-number">1.1.3.2.</span> <span class="toc-text">安装一下开发工具软件（git） 执行一个就可以</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E9%A2%9D%E5%A4%96%E4%BE%9D%E8%B5%96"><span class="toc-number">1.1.3.3.</span> <span class="toc-text">安装额外依赖</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%AE%89%E8%A3%85Mysql%EF%BC%88rpm%E5%8C%85%E5%AE%89%E8%A3%85%EF%BC%89"><span class="toc-number">1.2.</span> <span class="toc-text">2 安装Mysql（rpm包安装）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-%E5%89%8D%E5%BE%80%E7%94%A8%E6%88%B7%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-number">1.2.1.</span> <span class="toc-text">2.1 前往用户根目录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-%E4%B8%8B%E8%BD%BDMySQL57"><span class="toc-number">1.2.2.</span> <span class="toc-text">2.2 下载MySQL57</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3-%E5%AE%89%E8%A3%85mysql57"><span class="toc-number">1.2.3.</span> <span class="toc-text">2.3 安装mysql57</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-4-%E5%90%AF%E5%8A%A8mysql57%E5%B9%B6%E6%9F%A5%E7%9C%8B%E5%90%AF%E5%8A%A8%E7%8A%B6%E6%80%81"><span class="toc-number">1.2.4.</span> <span class="toc-text">2.4 启动mysql57并查看启动状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-5-%E6%9F%A5%E7%9C%8B%E9%BB%98%E8%AE%A4%E5%AF%86%E7%A0%81%E5%B9%B6%E7%99%BB%E5%BD%95"><span class="toc-number">1.2.5.</span> <span class="toc-text">2.5 查看默认密码并登录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-6-%E4%BF%AE%E6%94%B9%E5%AF%86%E7%A0%81"><span class="toc-number">1.2.6.</span> <span class="toc-text">2.6 修改密码</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%AE%89%E8%A3%85Redis-%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85"><span class="toc-number">1.3.</span> <span class="toc-text">3 安装Redis(源码编译安装)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-1-%E5%89%8D%E5%BE%80%E7%94%A8%E6%88%B7%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-number">1.3.1.</span> <span class="toc-text">3.1 前往用户根目录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-%E4%B8%8B%E8%BD%BDredis-5-0-5"><span class="toc-number">1.3.2.</span> <span class="toc-text">3.2 下载redis-5.0.5</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-3-%E8%A7%A3%E5%8E%8B%E5%AE%89%E8%A3%85%E5%8C%85"><span class="toc-number">1.3.3.</span> <span class="toc-text">3.3 解压安装包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-4-%E8%BF%9B%E5%85%A5%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6"><span class="toc-number">1.3.4.</span> <span class="toc-text">3.4 进入目标文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-5-%E7%BC%96%E8%AF%91%E7%8E%AF%E5%A2%83"><span class="toc-number">1.3.5.</span> <span class="toc-text">3.5 编译环境</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-6-%E5%A4%8D%E5%88%B6%E7%8E%AF%E5%A2%83%E5%88%B0%E6%8C%87%E5%AE%9A%E8%B7%AF%E5%BE%84%E5%AE%8C%E6%88%90%E5%AE%89%E8%A3%85"><span class="toc-number">1.3.6.</span> <span class="toc-text">3.6 复制环境到指定路径完成安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-7-%E9%85%8D%E7%BD%AEredis%E5%8F%AF%E4%BB%A5%E5%90%8E%E5%8F%B0%E5%90%AF%E5%8A%A8%EF%BC%9A%E4%BF%AE%E6%94%B9%E4%B8%8B%E6%96%B9%E5%86%85%E5%AE%B9%EF%BC%88%E5%8F%AF%E4%BB%A5%E4%B8%8D%E6%94%B9%EF%BC%89"><span class="toc-number">1.3.7.</span> <span class="toc-text">3.7 配置redis可以后台启动：修改下方内容（可以不改）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-8-%E5%AE%8C%E6%88%90%E9%85%8D%E7%BD%AE%E4%BF%AE%E6%94%B9"><span class="toc-number">1.3.8.</span> <span class="toc-text">3.8 完成配置修改</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-9-%E5%BB%BA%E7%AB%8B%E8%BD%AF%E8%BF%9E%E6%8E%A5-usr-bin-%E5%9C%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E4%B8%8B%EF%BC%8C%E4%BB%A5%E5%90%8E%E4%BB%BB%E6%84%8F%E8%B7%AF%E5%BE%84%E6%95%B2%E8%BF%99%E4%BF%A9%E5%91%BD%E4%BB%A4%E9%83%BD%E5%8F%AF%E4%BB%A5"><span class="toc-number">1.3.9.</span> <span class="toc-text">3.9 建立软连接 #&#x2F;usr&#x2F;bin&#x2F;在环境变量下，以后任意路径敲这俩命令都可以</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-10-%E5%90%8E%E5%8F%B0%E8%BF%90%E8%A1%8Credis"><span class="toc-number">1.3.10.</span> <span class="toc-text">3.10 后台运行redis</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-11-%E6%B5%8B%E8%AF%95redis%E7%8E%AF%E5%A2%83"><span class="toc-number">1.3.11.</span> <span class="toc-text">3.11 测试redis环境</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-12-%E5%85%B3%E9%97%ADredis%E6%9C%8D%E5%8A%A1"><span class="toc-number">1.3.12.</span> <span class="toc-text">3.12 关闭redis服务</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E5%AE%89%E8%A3%85python%E8%A7%A3%E9%87%8A%E5%99%A8%EF%BC%883-8%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85%EF%BC%89"><span class="toc-number">1.4.</span> <span class="toc-text">4 安装python解释器（3.8源码安装）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-%E5%89%8D%E5%BE%80%E7%94%A8%E6%88%B7%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-number">1.4.1.</span> <span class="toc-text">4.1 前往用户根目录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-2-%E8%A7%A3%E9%87%8A%E5%99%A8%E4%B8%8B%E8%BD%BD"><span class="toc-number">1.4.2.</span> <span class="toc-text">4.2 解释器下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-3-%E8%A7%A3%E5%8E%8B%E5%AE%89%E8%A3%85%E5%8C%85"><span class="toc-number">1.4.3.</span> <span class="toc-text">4.3 解压安装包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-4-%E8%BF%9B%E5%85%A5%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6"><span class="toc-number">1.4.4.</span> <span class="toc-text">4.4 进入目标文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-5-%E9%85%8D%E7%BD%AE%E5%AE%89%E8%A3%85%E8%B7%AF%E5%BE%84%EF%BC%9A-usr-local-python3"><span class="toc-number">1.4.5.</span> <span class="toc-text">4.5 配置安装路径：&#x2F;usr&#x2F;local&#x2F;python3</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-6-%E7%BC%96%E8%AF%91%E5%B9%B6%E5%AE%89%E8%A3%85"><span class="toc-number">1.4.6.</span> <span class="toc-text">4.6 编译并安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-7%E5%BB%BA%E7%AB%8B%E8%BD%AF%E8%BF%9E%E6%8E%A5%EF%BC%9A%E7%BB%88%E7%AB%AF%E5%91%BD%E4%BB%A4-python3%EF%BC%8Cpip3"><span class="toc-number">1.4.7.</span> <span class="toc-text">4.7建立软连接：终端命令 python3，pip3</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-8-%E5%88%A0%E9%99%A4%E5%AE%89%E8%A3%85%E5%8C%85%E4%B8%8E%E6%96%87%E4%BB%B6"><span class="toc-number">1.4.8.</span> <span class="toc-text">4.8 删除安装包与文件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E5%AE%89%E8%A3%85uwsgi"><span class="toc-number">1.5.</span> <span class="toc-text">5 安装uwsgi</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#5-1-uwsgi-django%E8%BF%90%E8%A1%8C"><span class="toc-number">1.5.1.</span> <span class="toc-text">5.1 uwsgi+django运行</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-2-%E4%BC%9A%E6%9C%89%E4%B8%80%E4%B8%AAuwsgi%E7%9A%84%E5%8F%AF%E6%89%A7%E8%A1%8C%E6%96%87%E4%BB%B6"><span class="toc-number">1.5.2.</span> <span class="toc-text">5.2 会有一个uwsgi的可执行文件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83"><span class="toc-number">1.6.</span> <span class="toc-text">6 安装虚拟环境</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#6-1-%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96"><span class="toc-number">1.6.1.</span> <span class="toc-text">6.1 安装依赖</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-%E5%BB%BA%E7%AB%8B%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%E8%BD%AF%E8%BF%9E%E6%8E%A5"><span class="toc-number">1.6.2.</span> <span class="toc-text">6.2 建立虚拟环境软连接</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-3-%E9%85%8D%E7%BD%AE%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%EF%BC%9A%E5%A1%AB%E5%85%A5%E4%B8%8B%E6%96%B9%E5%86%85%E5%AE%B9"><span class="toc-number">1.6.3.</span> <span class="toc-text">6.3 配置虚拟环境：填入下方内容</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-4-%E9%80%80%E5%87%BA%E7%BC%96%E8%BE%91%E7%8A%B6%E6%80%81"><span class="toc-number">1.6.4.</span> <span class="toc-text">6.4 退出编辑状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-5-%E4%BF%9D%E5%AD%98%E4%BF%AE%E6%94%B9%E5%B9%B6%E9%80%80%E5%87%BA"><span class="toc-number">1.6.5.</span> <span class="toc-text">6.5 保存修改并退出</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-6%E6%9B%B4%E6%96%B0%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="toc-number">1.6.6.</span> <span class="toc-text">6.6更新配置文件内容</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-7-%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%E9%BB%98%E8%AE%A4%E6%A0%B9%E7%9B%AE%E5%BD%95%EF%BC%9A"><span class="toc-number">1.6.7.</span> <span class="toc-text">6.7 虚拟环境默认根目录：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-8-%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83"><span class="toc-number">1.6.8.</span> <span class="toc-text">6.8 创建虚拟环境</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-%E5%AE%89%E8%A3%85Nginx-%E8%AF%B7%E6%B1%82%E8%BD%AC%E5%8F%91%EF%BC%8C%E5%8A%A8%E9%9D%99%E5%88%86%E7%B1%BB"><span class="toc-number">1.7.</span> <span class="toc-text">7 安装Nginx (请求转发，动静分类)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#7-1-%E5%89%8D%E5%BE%80%E7%94%A8%E6%88%B7%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-number">1.7.1.</span> <span class="toc-text">7.1 前往用户根目录</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-2-%E4%B8%8B%E8%BD%BDnginx-1-13-7"><span class="toc-number">1.7.2.</span> <span class="toc-text">7.2 下载nginx 1.13.7</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-3-%E8%A7%A3%E5%8E%8B%E5%AE%89%E8%A3%85%E5%8C%85"><span class="toc-number">1.7.3.</span> <span class="toc-text">7.3 解压安装包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-4-%E8%BF%9B%E5%85%A5%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6"><span class="toc-number">1.7.4.</span> <span class="toc-text">7.4 进入目标文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-5-%E9%85%8D%E7%BD%AE%E5%AE%89%E8%A3%85%E8%B7%AF%E5%BE%84%EF%BC%9A-usr-local-nginx"><span class="toc-number">1.7.5.</span> <span class="toc-text">7.5 配置安装路径：&#x2F;usr&#x2F;local&#x2F;nginx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-6-%E7%BC%96%E8%AF%91%E5%B9%B6%E5%AE%89%E8%A3%85"><span class="toc-number">1.7.6.</span> <span class="toc-text">7.6 编译并安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-7-%E5%BB%BA%E7%AB%8B%E8%BD%AF%E8%BF%9E%E6%8E%A5%EF%BC%9A%E7%BB%88%E7%AB%AF%E5%91%BD%E4%BB%A4-nginx"><span class="toc-number">1.7.7.</span> <span class="toc-text">7.7 建立软连接：终端命令 nginx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-8-%E5%88%A0%E9%99%A4%E5%AE%89%E8%A3%85%E5%8C%85%E4%B8%8E%E6%96%87%E4%BB%B6%EF%BC%9A"><span class="toc-number">1.7.8.</span> <span class="toc-text">7.8 删除安装包与文件：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-9%E6%B5%8B%E8%AF%95Nginx%E7%8E%AF%E5%A2%83%EF%BC%8C%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BF%90%E8%A1%8Cnginx%EF%BC%8C%E6%9C%AC%E5%9C%B0%E8%AE%BF%E9%97%AE%E6%9C%8D%E5%8A%A1%E5%99%A8ip"><span class="toc-number">1.7.9.</span> <span class="toc-text">7.9测试Nginx环境，服务器运行nginx，本地访问服务器ip</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-10-nginx-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">1.7.10.</span> <span class="toc-text">7.10  nginx 常用命令</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-%E9%85%8D%E7%BD%AE%E5%89%8D%E7%AB%AF%E9%A1%B9%E7%9B%AE%EF%BC%8C%E4%B8%8A%E7%BA%BF%E9%83%A8%E7%BD%B2"><span class="toc-number">1.8.</span> <span class="toc-text">8 配置前端项目，上线部署</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#8-1-%E6%8A%8Asetting-js%E4%B8%AD%E7%9A%84%E5%90%8E%E7%AB%AF%E8%B7%AF%E5%BE%84%E6%94%B9%E6%88%90%E5%85%AC%E7%BD%91%E5%9C%B0%E5%9D%80"><span class="toc-number">1.8.1.</span> <span class="toc-text">8.1 把setting.js中的后端路径改成公网地址</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-2-%E6%8A%8Avue%E9%A1%B9%E7%9B%AE%E7%BC%96%E8%AF%91%E6%88%90%E7%BA%AF%E9%9D%99%E6%80%81"><span class="toc-number">1.8.2.</span> <span class="toc-text">8.2 把vue项目编译成纯静态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-3-%E5%9C%A8%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E5%AE%89%E8%A3%85"><span class="toc-number">1.8.3.</span> <span class="toc-text">8.3 在服务器上安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-4-%E8%A7%A3%E5%8E%8B"><span class="toc-number">1.8.4.</span> <span class="toc-text">8.4 解压</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-5-%E9%85%8D%E7%BD%AEnginx%EF%BC%8C%E4%BB%A3%E7%90%86%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6"><span class="toc-number">1.8.5.</span> <span class="toc-text">8.5 配置nginx，代理静态文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-6-%E9%87%8D%E5%90%AFnginx%E5%8D%B3%E5%8F%AF"><span class="toc-number">1.8.6.</span> <span class="toc-text">8.6 重启nginx即可</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-7-%E8%AE%BF%E9%97%AEIP%E5%B0%B1%E8%83%BD%E7%9C%8B%E5%88%B0%E5%89%8D%E7%AB%AF"><span class="toc-number">1.8.7.</span> <span class="toc-text">8.7 访问IP就能看到前端</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-%E9%85%8D%E7%BD%AE%E5%90%8E%E5%8F%B0%E9%A1%B9%E7%9B%AE%EF%BC%8C%E9%83%A8%E7%BD%B2"><span class="toc-number">1.9.</span> <span class="toc-text">9 配置后台项目，部署</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#9-1-%E9%A1%B9%E7%9B%AE%E4%BE%9D%E8%B5%96%E5%BA%93"><span class="toc-number">1.9.1.</span> <span class="toc-text">9.1 项目依赖库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-2-%E5%9C%A8%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%EF%BC%8C%E6%8A%8A%E5%90%8E%E7%AB%AF%E9%A1%B9%E7%9B%AE%E6%8B%89%E4%B8%8B%E6%9D%A5"><span class="toc-number">1.9.2.</span> <span class="toc-text">9.2 在服务器上，把后端项目拉下来</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-3-%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%EF%BC%8C%E5%9C%A8%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%E4%B8%AD%EF%BC%8C%E6%8A%8A%E6%89%80%E6%9C%89%E4%BE%9D%E8%B5%96%E8%A3%85%E5%A5%BD"><span class="toc-number">1.9.3.</span> <span class="toc-text">9.3 创建虚拟环境，在虚拟环境中，把所有依赖装好</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-4-%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.9.4.</span> <span class="toc-text">9.4 配置数据库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-5-%E8%BF%81%E7%A7%BB%E5%91%BD%E4%BB%A4"><span class="toc-number">1.9.5.</span> <span class="toc-text">9.5 迁移命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-6-%E4%BD%BF%E7%94%A8uwsgi-django%E8%BF%90%E8%A1%8C%E9%A1%B9%E7%9B%AE"><span class="toc-number">1.9.6.</span> <span class="toc-text">9.6 使用uwsgi+django运行项目</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-7%E5%86%99uwsgi%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%EF%BC%8C%E9%A1%B9%E7%9B%AE%E6%A0%B9%E8%B7%AF%E5%BE%84"><span class="toc-number">1.9.7.</span> <span class="toc-text">9.7写uwsgi的配置文件，项目根路径</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-8%E5%90%AF%E5%8A%A8uwsgi"><span class="toc-number">1.9.8.</span> <span class="toc-text">9.8启动uwsgi</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-9-%E5%85%B3%E9%97%ADuwsgi"><span class="toc-number">1.9.9.</span> <span class="toc-text">9.9 关闭uwsgi</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-10%E9%85%8D%E7%BD%AEnginx%E8%BD%AC%E5%8F%91%E7%BB%99uwsgi"><span class="toc-number">1.9.10.</span> <span class="toc-text">9.10配置nginx转发给uwsgi</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-11-%E6%9F%A5%E7%9C%8B%E7%AB%AF%E5%8F%A3%E8%A2%AB%E5%93%AA%E4%B8%AA%E8%BF%9B%E7%A8%8B%E7%9B%91%E5%90%AC"><span class="toc-number">1.9.11.</span> <span class="toc-text">9.11 查看端口被哪个进程监听</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-12-%E5%AF%BC%E5%85%A5%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE"><span class="toc-number">1.9.12.</span> <span class="toc-text">9.12 导入测试数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-13-%E5%90%8E%E5%8F%B0%E7%AE%A1%E7%90%86%EF%BC%8C%E5%8A%A8%E9%9D%99%E5%88%86%E7%A6%BB"><span class="toc-number">1.9.13.</span> <span class="toc-text">9.13 后台管理，动静分离</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-14-%E4%BD%BF%E7%94%A8nginx%E4%BB%A3%E7%90%86"><span class="toc-number">1.9.14.</span> <span class="toc-text">9.14 使用nginx代理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-15-%E9%87%8D%E5%90%AFnginx%E5%8D%B3%E5%8F%AF"><span class="toc-number">1.9.15.</span> <span class="toc-text">9.15 重启nginx即可</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-16-%E9%A1%B9%E7%9B%AE%E6%A0%B9%E8%B7%AF%E5%BE%84%E4%B8%8B%E5%90%AF%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1"><span class="toc-number">1.9.16.</span> <span class="toc-text">9.16 项目根路径下启异步任务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-17-%E9%A1%B9%E7%9B%AE%E8%BF%9E%E6%8E%A5%E4%B8%8A%E5%9F%9F%E5%90%8D"><span class="toc-number">1.9.17.</span> <span class="toc-text">9.17 项目连接上域名</span></a></li></ol></li></ol></li></ol>
</div>
<style>
    .left-col .switch-btn {
        display: none;
    }
    .left-col .switch-area {
        display: none;
    }
</style>
<input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

<script>
    var valueHide = "隐藏目录";
    var valueShow = "显示目录";
    if ($(".left-col").is(":hidden")) {
        $("#tocButton").attr("value", valueShow);
    }
    $("#tocButton").click(function() {
        if ($("#toc").is(":hidden")) {
            $("#tocButton").attr("value", valueHide);
            $("#toc").slideDown(320);
            $(".switch-btn, .switch-area").fadeOut(300);
        }
        else {
            $("#tocButton").attr("value", valueShow);
            $("#toc").slideUp(350);
            $(".switch-btn, .switch-area").fadeIn(500);
        }
    })
    if ($(".toc").length < 1) {
        $("#toc, #tocButton").hide();
        $(".switch-btn, .switch-area").show();
    }
</script>




<div class="bdsharebuttonbox">
	<a href="#" class="fx fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
	<a href="#" class="fx fa-weixin bds_weixin" data-cmd="weixin" title="分享到微信"></a>
	<a href="#" class="fx fa-qq bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
	<a href="#" class="fx fa-facebook-official bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
	<a href="#" class="fx fa-twitter bds_twi" data-cmd="twi" title="分享到Twitter"></a>
	<a href="#" class="fx fa-linkedin bds_linkedin" data-cmd="linkedin" title="分享到linkedin"></a>
	<a href="#" class="fx fa-files-o bds_copy" data-cmd="copy" title="分享到复制网址"></a>
</div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"2","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>




    
        <section class="changyan" id="comments">
  <!--<div id="uyan_frame"></div>-->
  <div id="SOHUCS"></div>
  <script charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/changyan.js"></script>
  <script type="text/javascript">
    window.changyan.api.config({
      appid: 'xxxx',
      conf: 'xxxxxxxxx'
    });
  </script>
</section>
    



    <div class="scroll" id="post-nav-button">
        
            <a  href="/chen-changxiao/2021/11/23/Docker%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2/" title="上一篇: Docker一键部署">
                <i class="fa fa-angle-left"></i>
            </a>
        
        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>
        
            <a  href="/chen-changxiao/2021/11/23/MySQL%E5%AE%89%E8%A3%85/" title="下一篇: MySQL数据库">
                <i class="fa fa-angle-right"></i>
            </a>
        
    </div>
    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/drf%E4%BA%94%E4%B8%AA%E6%8E%A5%E5%8F%A3%E7%9A%84%E5%BF%AB%E9%80%9F%E5%AE%9E%E7%8E%B0%E6%96%B9%E6%B3%95/">drf五个接口的快速实现方法</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/%E5%85%A8%E5%B1%80%E8%A7%84%E5%AE%9A%E8%AF%B7%E6%B1%82%E6%A0%BC%E5%BC%8F%E7%BC%96%E7%A0%81%E4%B8%8E%E5%93%8D%E5%BA%94%E6%A0%BC%E5%BC%8F%E7%BC%96%E7%A0%81/">全局规定请求格式编码与响应格式编码</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/%E5%90%8E%E7%AB%AF%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83/">后端创建虚拟环境</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/pip%E6%8D%A2%E6%BA%90/">pip换源</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/Docker%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2/">Docker一键部署</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/%E4%B8%8A%E7%BA%BF/">项目上线部署</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/MySQL%E5%AE%89%E8%A3%85/">MySQL数据库</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/23/%E5%B0%81%E8%A3%85logger%E3%80%81%E5%B0%81%E8%A3%85%E9%A1%B9%E7%9B%AE%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86%E3%80%81%E4%BA%8C%E6%AC%A1%E5%B0%81%E8%A3%85Response%E6%A8%A1%E5%9D%97/">封装logger、封装项目异常处理、二次封装Response模块</a></li><li class="post-list-item"><a class="post-list-link" href="/chen-changxiao/2021/11/19/Python/">Python</a></li></ul>
    
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>

    <script>
        $(".post-list").addClass("toc-article");
        // $(".post-list-item a").attr("target","_blank");
        $("#post-nav-button > a:nth-child(2)").click(function() {
            $(".fa-bars, .fa-times").toggle();
            $(".post-list").toggle(300);
            if ($(".toc").length > 0) {
                $("#toc, #tocButton").toggle(200, function() {
                    if ($(".switch-area").is(":visible")) {
                        $("#toc, .switch-btn, .switch-area").toggle();
                        $("#tocButton").attr("value", valueHide);
                        }
                    })
            }
            else {
                $(".switch-btn, .switch-area").fadeToggle(300);
            }
        })
    </script>




    <script>
        
    </script>

</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                &copy; 2021 昌晓
            </div>
            <div class="footer-right">
                <a href="http://hexo.io/" target="_blank">Hexo &nbsp;&nbsp;</a><a href="https://github.com/maochunguang" target="_blank">Blog</a> by tommy
            </div>
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" >极客到访数: 
                            <span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>, </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit">本页阅读量: 
                            <span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>

    </div>
    
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>


<script src="/chen-changxiao/js/main.js"></script>


    <script>
        $(document).ready(function() {
            var backgroundnum = 1;
            var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
            $("#mobile-nav").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
            $(".left-col").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
        })
    </script>


<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'xxxxx', 'auto');
ga('send', 'pageview');

</script>
<!-- End Google Analytics -->



	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?xxxxxx";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>



<div class="scroll" id="scroll">
    <a href="#"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments"><i class="fa fa-comments-o"></i></a>
    <a href="#footer"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    $(document).ready(function() {
        if ($("#comments").length < 1) {
            $("#scroll > a:nth-child(2)").hide();
        };
    })
</script>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

  <script language="javascript">
    $(function() {
        $("a[title]").each(function() {
            var a = $(this);
            var title = a.attr('title');
            if (title == undefined || title == "") return;
            a.data('title', title).removeAttr('title').hover(
            function() {
                var offset = a.offset();
                $("<div id=\"anchortitlecontainer\"></div>").appendTo($("body")).html(title).css({
                    top: offset.top - a.outerHeight() - 15,
                    left: offset.left + a.outerWidth()/2 + 1
                }).fadeIn(function() {
                    var pop = $(this);
                    setTimeout(function() {
                        pop.remove();
                    }, pop.text().length * 800);
                });
            }, function() {
                $("#anchortitlecontainer").remove();
            });
        });
    });
</script>


  </div>
</body>
</html>